import React from "react";
import { createBrowserRouter, RouterProvider } from "react-router-dom";
import { menus, routerParse } from "@/router/routes";
import { AuthProvider, useAuth } from "@/Context/AuthContext";

function App() {
  const { isAuthenticated } = useAuth();

  const routes = routerParse(menus, isAuthenticated);

  const router = createBrowserRouter(routes);

  return <RouterProvider router={router} />;
}
  

export default function Root() {
  return (
    <AuthProvider>
      <App />
    </AuthProvider>
  );
}
